﻿<!DOCTYPE HTML>
<html th:with="title='商品管理'">
<head th:include="fragments/header :: header">
<meta charset="utf-8" />
</head>
<body id="app">
	<div class="page-container">
		<div class="text-1 pd-5">
			云科号：
			<input type="text" class="input-text radius size-L" th:value="${user.outSn}" style="width: 300px" placeholder="请输入云科号" id="yunkeNum" name="yunkeNum">
			<button type="button" class="btn btn-success size-L radius" onclick="syncYKProduct()">
				<i class="Hui-iconfont">&#xe665;</i>
				同步云科商品
			</button>
		</div>
	</div>
	<script type="text/javascript">
		// ==================================================
		var app = new Vue({
			el : '#app',
			data : {
				pageData : {}
			}
		});

		/*
		 * 查询所有云科商品
		 */
		function syncYKProduct() {
			var tip = layer.load(0, {
				shade : false
			});
			$.ajax({
				type : "POST",
				url : '/manager/product/syncYKProduct',
				data : {
					pageNo : 1,
					pageSize : 10,
					yunkeNum : $("#yunkeNum").val()
				},
				beforeSend : function() {
				},
				complete : function() {
					layer.close(tip);
				},
				error : function(request) {
					layer.alert("系统错误");
				},
				success : function(result) {
					if (result.status == 0) {
						refreshUParentList();
						layer.alert(result.message, function() {
							var index = parent.layer.getFrameIndex(window.name);
							parent.layer.close(index);
						});
					} else {
						sessionCheckTimeOut(result);
					}
				}
			});
		}

		/*
		 * 查询
		 */
		function query(pageNo, pageSize) {
			if (!pageNo) {
				pageNo = 1;
			}
			if (!pageSize) {
				pageSize = $("#pageSizeSelect").val();
			}
			var tip = layer.load(0, {
				shade : false
			});
			$.ajax({
				type : "POST",
				url : '/manager/product/queryPage',
				data : {
					pageNo : pageNo,
					pageSize : pageSize,
					search_LIKE_name : $("#name").val(),
					search_LIKE_bussinesName : $("#bussinesName").val()
				},
				beforeSend : function() {
				},
				complete : function() {
					layer.close(tip);
				},
				error : function(request) {
					layer.alert("系统错误");
				},
				success : function(result) {
					if (result.status == 0) {
						var data = result.data;
						app.pageData = data;
						laypage({
							cont : 'pageNav',
							pages : data.totalPage,
							curr : data.currentPage,
							skip : true,
							groups : 6,
							jump : function(obj, first) {
								if (!first) {
									query(obj.curr);
								}
							}
						});
					} else {
						sessionCheckTimeOut(result);
					}
				}
			});
		}
	</script>
</body>
</html>